package com.android.hedgehog;

import java.util.List;

import android.graphics.Color;

import com.android.hedgehog.bots.BotConfigurations;
import com.android.hedgehog.framework.Game;
import com.android.hedgehog.framework.Graphics;
import com.android.hedgehog.framework.Screen;
import com.android.hedgehog.framework.Input.TouchEvent;

public class VersesScreen extends Screen {
	Graphics graphics;
	int botNumber;
	BotConfigurations data = new BotConfigurations();

	public VersesScreen(Game game, int level) {
		super(game);
		botNumber = level;
		graphics = game.getGraphics();
	}

	@Override
	public void update(float deltaTime) {
		List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
		game.getInput().getKeyEvents();

		int len = touchEvents.size();
		for (int i = 0; i < len; i++) {
			TouchEvent event = touchEvents.get(i);
			if (event.type == TouchEvent.TOUCH_UP) {
				if (event.x > 90 && event.x < 230 && event.y > 360 && event.y < 400) {
					game.setScreen(new BattleScreen(game, botNumber));
					return;
				}
				if (event.x < 40 && event.y > 440) {
					game.setScreen(new LevelSelect(game));
				}
			}
		}

	}

	@Override
	public void present(float deltaTime) {
		graphics.drawBackground(Color.DKGRAY);

		graphics.drawPixmap(Assets.botprofiles, 140, 105, 0+(140*botNumber), 0, 140, 160);
		graphics.drawUniversalRect(140, 105, 140, 160, false, false, 7, 255, Color.BLACK);

		graphics.drawUniversalText("Speed", 2, true, 70, 150, 24, 255, Color.argb(255, 70, 252, 8));
		graphics.drawUniversalText(data.speedDisplay[botNumber] + "/10", 2, true, 70, 170, 16, 255,
				Color.argb(255, 70, 252, 8));
		graphics.drawUniversalText("Memory", 2, true, 70, 215, 24, 255, Color.argb(255, 120, 252, 50));
		graphics.drawUniversalText(data.memoryDisplay[botNumber] + "/10", 2, true, 70, 235, 16, 255,
				Color.argb(255, 120, 252, 50));

		graphics.drawUniversalText("vs", 2, true, 160, 40, 30, 255, Color.YELLOW);
		graphics.drawUniversalText(data.names[botNumber], 2, true, 160, 80, 36, 255, Color.YELLOW);
		graphics.drawUniversalText("- "+data.line1[botNumber], 2, false, 20, 300, 15, 255,
				Color.argb(255, 200, 200, 200));
		graphics.drawUniversalText("  "+data.line2[botNumber], 2, false, 20, 322, 15, 255,
				Color.argb(255, 200, 200, 200));

		graphics.drawUniversalRect(90, 360, 140, 40, false, true, 1, 255, Color.RED); // READY?
		graphics.drawUniversalRect(90, 360, 140, 40, false, false, 5, 255, Color.BLACK);
		graphics.drawUniversalText("READY", 2, true, 160, 393, 26, 255, Color.BLACK);

		graphics.drawUniversalRect(0, 440, 40, 40, false, true, 3, 255, Color.WHITE); // back

	}

	@Override
	public void pause() {
		// TODO Auto-generated method stub

	}

	@Override
	public void resume() {
		// TODO Auto-generated method stub

	}

	@Override
	public void dispose() {
		// TODO Auto-generated method stub

	}

}
